﻿using AutoMapper.Configuration.Conventions;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using S.Archives.Domain.S.ArchivesDto;
using S.Common.Enums.Archives;
using S.Common.helper;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;

namespace S.Archives.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class HttpCilentController : ControllerBase
    {
        /// <summary>
        /// 跨服务添加角色
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        /// 
        [HttpPost("AddRole")]
        public IActionResult AddRole(RoleAddDto role)
        {
            var result = HttpClientHelper.PostResponse("https://localhost:7026/api/RoleMenu/AddRole", role);
          
            return Ok(result);
        }
        /// <summary>
        /// 跨服务删除耳标
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpPost("DeleteRole")]
        public IActionResult DeleteEarTag(int id)
        {
            var result = HttpClientHelper.DeleteResponse($"http://localhost:5283/api/EarTag/DeleteEarTag?id={id}");
            return Ok(result);
        }
        /// <summary>
        /// 跨服务修改角色
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>

        [HttpPut("UpdateRole")]
        public IActionResult UpdateRole(RoleAddDto role)
        {
            var reqult = HttpClientHelper.PutDataResponse("https://localhost:7026/api/RoleMenu/UpdateRole", role);
            return Ok(reqult);
        }
        /// <summary>
        /// 跨服务修改流转状态测试
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        [HttpPut("WanderStateEditPLHttp")]
        public IActionResult WanderStateEditPLHttp(WanderStateEdit t)
        {
            var result = HttpClientHelper.PutDataResponse(" https://localhost:7191/api/SheepFileModel/WanderStateEditPL", t);
            return Ok(result);
        }
        /// <summary>
        /// 周文浩
        /// </summary>
        /// <returns></returns>
        [HttpDelete("GetZhou")]
        public IActionResult GetZhou()
        {
           DateTime date=DateTime.Now;
            string a = "2023 / 9 / 8 11:43:55";
            DateTime b = DateTime.Parse(a);
            var d = HttpClientHelper.DeleteResponse($"http://10.31.56.7:7061/api/TransFer/DeleteSheepTransFer?EarTag=AB2&SurrenderDate={b}");
            return Ok(d);
        }
        public class WanderStateEdit
        {
            /// <summary>
            /// 可视耳号
            /// </summary>
            /// 

            public List<string> EarTag { get; set; }
            /// <summary>
            /// 流转繁殖状态
            /// </summary>
            public WanderReproductiveStateEnum? WanderReproductiveState { get; set; }
        }
        public class SheepRescission
        {
            /// <summary>
            /// 转舍主键，自增标识列
            /// </summary>
            [Key]
            public int SheepRescissionId { get; set; }
            /// <summary>
            /// 可视耳标
            /// </summary>
            public string? EarTag { get; set; }
            /// <summary>
            /// 转舍日期
            /// </summary>
            public DateTime? SurrenderDate { get; set; }
            /// <summary>
            /// 转舍类型
            /// </summary>
            public int RoundType { get; set; }
            /// <summary>
            /// 转出栋舍
            /// </summary>
            public int TurnOutBuild { get; set; }
            /// <summary>
            /// 转出栏位
            /// </summary>
            public int TurnOutHuts { get; set; }
            /// <summary>
            /// 转出栋舍主键
            /// </summary>
            public int TurnOuBuildingManagementId { get; set; }
            /// <summary>
            /// 转出栏位主键
            /// </summary>
            public int TurnOuColumnManagementId { get; set; }
            /// <summary>
            /// 转入栋舍
            /// </summary>
            public int ShiftToBuild { get; set; }
            /// <summary>
            /// 转入栏位
            /// </summary>
            public int ShiftToHuts { get; set; }
            /// <summary>
            /// 转入栋舍主键
            /// </summary>
            public int ShiftToBuildingManagementId { get; set; }
            /// <summary>
            /// 转入栏位主键
            /// </summary>
            public int ShiftToColumnManagementId { get; set; }
            /// <summary>
            /// /// <summary>
            /// 品种
            /// </summary>
            public int? Variety { get; set; }
            /// 创建人
            /// </summary>
            [Column(TypeName = "nvarchar(20)")]
            [MaxLength(20)]
            public string? CreateBy { get; set; }
            /// <summary>
            /// 创建时间
            /// </summary>
            public DateTime? CreateDate { get; set; }
            /// <summary>
            /// 修改人
            /// </summary>
            [Column(TypeName = "nvarchar(20)")]
            [MaxLength(20)]
            public string? UpdateBy { get; set; }
            /// <summary>
            /// 修改时间
            /// </summary>
            public DateTime? UpdateDate { get; set; }
            /// <summary>
            /// 是否删除
            /// </summary>
            public bool IsDel { get; set; }
            /// <summary>
            /// 单据号
            /// </summary>
            public long DocumentNumbe { get; set; }
            /// <summary>
            /// 羊只类型
            /// </summary>
            public string? Type { get; set; }
            /// <summary>
            /// 性别
            /// </summary>
            public int Sex { get; set; }

        }
    }
}
